<template>
  <div id="app">
    <nav></nav>
    <router-view />
  </div>
</template>
<script>
export default {
  name: "app",
  data() {
    return {};
  },
  methods: {
    // 线上扫码
    init() {
      let url = window.location.href;
      console.log(url);
      if (url.indexOf("token") === -1) {
        if (
          url.indexOf("localhost") !== -1 ||
          url.indexOf("192.168") !== -1 ||
          url.indexOf("183.162.") !== -1 ||
          url.indexOf("test") !== -1
        ) {
          // this.$router.push("/");
          //  window.location.href =
          // http://eop.ops.anhuitelecom.com:10001/api/eam-apps/oauth/token  CTAHCDJCGZFW20220711
          //   "http://134.64.116.90:9021/eam-apps/oauth/authorize?response_type=code&client_id=CTAHJQRZXXLPT20220711&redirect_uri=http://134.64.248.185:8666/robot/single/getToken";
        } else {
          window.location.href =
            "http://tyrz.ops.anhuitelecom.com:10500/eam-apps/oauth/authorize?response_type=code&client_id=CTAHCDJCGZFW20220711&redirect_uri=http://134.64.248.185:8666/screen/token/getToken";
        }
      } else {
        let arr = url.split("=");
        let token = "";
        let temp = "";
        for (let i = 0; i < arr.length; i++) {
          if (arr[i].includes("token")) {
            temp = arr[i + 1];
            break;
          }
        }
        if (temp && temp.includes("&")) {
          token = temp.split("&")[0];
        } else {
          token = temp;
        }
        console.log("token", token);
        window.sessionStorage.setItem("user-login", token);
        // if (reg) {
        //   let temp = reg[0].split("=");
        //   let token = temp[1];

        //   // this.$cookie.set("token", data.token);
        //   // this.$router.push("index");
        // }
      }
    },
  },
  created() {
    // this.init();
  },
};
</script>

<style lang="scss">
#app {
  margin: 0;
  padding: 0;
}
* {
  margin: 0;
  padding: 0;
}
ul,
li {
  list-style: none;
}
/* 重写滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
/* Track */
::-webkit-scrollbar-track {
  background: rgb(255, 255, 255);
  border-radius: 8px;
}
/* Handle */
::-webkit-scrollbar-thumb {
  background: rgb(201, 201, 202);
  border-radius: 8px;
  transition: all 0.5s;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: rgb(162, 162, 163);
}
.el-menu::-webkit-scrollbar,
.el-table__body-wrapper::-webkit-scrollbar {
  /* display: none; */
}
.el-menu:hover::-webkit-scrollbar,
.el-table__body-wrapper:hover::-webkit-scrollbar {
  display: block;
}
</style>
